Skip to content

Instantly share code, notes, and snippets.

View cadrev's full-sized avatar

Felan Carlo Garcia cadrev

View GitHub Profile
@cadrev
cadrev / delete_jpeg
Created June 21, 2015 13:20
Delete all jpeg inside a folder
find . -type f -iname \*.jpg -delete
@cadrev
cadrev / copy_jpeg
Created June 21, 2015 13:22
Copy all jpeg to a directory
find . -type f \( -iname "*.jpg" -o -iname "*.jpeg" \) -exec cp '{}' /dirname \;
@cadrev
cadrev / pandas_shuffle.py
Last active August 22, 2020 08:40
Shuffle the rows of a python pandas dataframe
'''
Title : Pandas Row Shuffler
Author : Felan Carlo Garcia
'''
import numpy as np
import pandas as pd
def shuffler(filename):
df = pd.read_csv(filename, header=0)
# return the pandas dataframe
@cadrev
cadrev / port-process-finder
Created June 21, 2015 15:57
find the process listening on a tcp port
sudo fuser -n tcp [local_port]
@cadrev
cadrev / sql-joins-cheatsheet.sql
Last active August 29, 2015 14:23
A cheatsheet for sql joins
-- Inner Join
SELECT * FROM A INNER JOIN B ON A.key = B.key
-- Left Join
SELECT * FROM A LEFT JOIN B ON A.key = B.key
-- Left Join without Intersection
SELECT * FROM A INNER JOIN B ON A.key = B.key where B.key IS NULL
-- Right Join
@cadrev
cadrev / conda-lockerror-solution
Created June 22, 2015 16:38
A solution to the LOCKERROR during conda install
conda clean --lock
@cadrev
cadrev / chown sample
Created June 25, 2015 08:32
Change the ownership of a folder in order to use winscp
chown username -R /whatever/floats/your/boat/dir
@cadrev
cadrev / reg-ex.py
Created July 7, 2015 02:37
Python Regex Test
'''
Removes punctuations and non Alpha-numeric characters, removes trailing spaces
and prints the string in lowercase
'''
import re
text = " sample_ @$@string %*hi^*&there "
clean_text = re.sub(r'[^A-Za-z0-9\s]+','',text).lower().strip()
@cadrev
cadrev / sys-ad-py-scripts
Created July 8, 2015 16:40
Sys ad scripts
http://www.pixelbeat.org/scripts/
/**
* Like, basically PERFECT scrollbars
*/
/*
It's pure CSS.
Since a quick google search will confirm people going crazy about Mac OS Lion scrollbars...
this has no fade-out effect.
In Mac OS Lion, the lowest common denominator is always showing scrollbars by a setting.