Skip to content

Instantly share code, notes, and snippets.

View FossilBlade's full-sized avatar
🦥
I may be slow to respond.

FossilBlade

🦥
I may be slow to respond.
View GitHub Profile
@FossilBlade
FossilBlade / avd_install
Last active February 14, 2022 01:39
avd install
echo no | avdmanager create avd --force --name Snapscore1 --abi google_apis_playstore/arm64-v8a --package 'system-images;android-Tiramisu;google_apis_playstore;arm64-v8a' --device 23
export ANDROID_HOME=/opt/android-sdk
export PATH=$ANDROID_HOME/platform-tools:$PATH
export PATH=$ANDROID_HOME/tools:$PATH
export PATH=$ANDROID_HOME/tools/bin:$PATH
export PATH=$ANDROID_HOME/emulator:$PATH
export PATH=$ANDROID_HOME/cmdline-tools/latest/bin:$PATH
@FossilBlade
FossilBlade / gist:372822481d8f816c7e2a484ce0d4b43a
Last active October 19, 2021 07:58
Install scipy and scikit-learn in mac M1

Finally managed to sort this using below steps:

  1. install python 3.9 using brew
 (brew install [email protected])
  2. setup PATH to pick brew python3 first (export PATH=opt/homebrew/bin:$PATH)
  3. Run below commands to install scipy and scikit-learn


    >> /opt/homebrew/bin/brew install openblas
    >> export OPENBLAS=$(/opt/homebrew/bin/brew --prefix openblas)
 >> export CFLAGS="-falign-functions=8 ${CFLAGS}"
@FossilBlade
FossilBlade / gdelta_parquet.py
Created March 1, 2021 04:07 — forked from nmukerje/gdelta_parquet.py
Converts the GDELT Dataset in S3 to Parquet.
# Get the column names
from urllib import urlopen
html = urlopen("http://gdeltproject.org/data/lookups/CSV.header.dailyupdates.txt").read().rstrip()
columns = html.split('\t')
# Load 73,385,698 records from 2016
df1 = spark.read.option("delimiter", "\t").csv("s3://gdelt-open-data/events/2016*")
# Apply the schema
df2=df1.toDF(*columns)
# Split SQLDATE to Year, Month and Day
from pyspark.sql.functions import expr
@FossilBlade
FossilBlade / gitlab_docker_runer_ec2.md
Created February 26, 2021 08:27
Setup Gitlab Docker Runner on EC2

Setup a EC2 with Ubuntu 18.0 and install docker to it


sudo bash -c "echo -n | openssl s_client -connect gitlab.hasselbit.com:64443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > /etc/gitlab-runner/certs/gitlab.hasselbit.com.crt"
#!/bin/bash
echo " -- Cleaning -- "
sudo rm request.csr
sudo rm *.pem
echo " -- Stop Services -- "
sudo /etc/init.d/tomcat7 stop
echo " -- Delete Keystore -- "
sudo rm /usr/local/tomcat7/.keystore

MySQL Download URL

https://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.56-linux-glibc2.5-x86_64.tar.gz

Open the terminal and follow along:

  • Uninstall any existing version of MySQL
sudo rm /var/lib/mysql/ -R
@FossilBlade
FossilBlade / example.com
Created May 15, 2020 13:36 — forked from 1hakr/example.com
Supercharge your NGIX config
proxy_cache_path /tmp/cacheapi levels=1:2 keys_zone=microcacheapi:100m max_size=1g inactive=1d use_temp_path=off;
server {
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
server_name example.com;
location /api/ {
# Rate Limiting
limit_req zone=reqlimit burst=20; # Max burst of request
@FossilBlade
FossilBlade / gitignore_effect.md
Last active May 13, 2020 06:46
Untrack files already added to git repository based on .gitignore

Step 1: Commit all your changes

Before proceeding, make sure all your changes are committed, including your .gitignore file.

Step 2: Remove everything from the repository

To clear your repo, use:

git rm -r --cached .

rm is the remove command -r will allow recursive removal

@FossilBlade
FossilBlade / Git _Credential _Cache.md
Last active May 9, 2020 08:12
Git Credential Cache

Configuring git-credential-cache on Linux

git-credential-cache is a useful tool to remember your HTTP/HTTPS git credentials (though you really should be using SSH instead). It’s useful when using long passwords or access tokens. It stores them in memory for a specific amount of time.

Enabling it

$ git config --global credential.helper cache

Setting the timeout

$ git config --global credential.helper 'cache --timeout=600'

Disabling it

$ git config --global --unset credential.helper

Mounting VirtualBox shared folders on Ubuntu Server 18.04 LTS (Bionic Beaver)

This guide will walk you through the steps on how to setup a VirtualBox shared folder inside your Ubuntu Server guest.

Prerequisites

This guide assumes that you are using the following setup:

You could still make this guide work with other setups (possibly with some modifications to the commands and whatnot).