Skip to content

Instantly share code, notes, and snippets.

View kanglicheng's full-sized avatar
🦜
LLMs ftw

Stephen Cheng kanglicheng

🦜
LLMs ftw
View GitHub Profile
@anirudhjayaraman
anirudhjayaraman / quicksort.py
Last active June 19, 2024 23:58
Python code for the Quick Sort Algorithm
def quicksort(x):
if len(x) == 1 or len(x) == 0:
return x
else:
pivot = x[0]
i = 0
for j in range(len(x)-1):
if x[j+1] < pivot:
x[j+1],x[i+1] = x[i+1], x[j+1]
i += 1
@unleashit
unleashit / React "Two Way Binding".markdown
Last active March 2, 2023 04:41 — forked from anonymous/React "Two Way Binding".markdown
React "Two Way Binding" with Redux
@phonglk
phonglk / Botasana.js
Last active April 15, 2017 02:35
CodeFight Botasana final challenge
function recurringTask(firstDate, k, daysOfTheWeek, n) {
const weekdays = ['Sunday', 'Monday', 'Tuesday', 'Wednesday',
'Thursday', 'Friday', 'Saturday'];
const splits = firstDate.split('/').map(x => parseInt(x));
const fday = new Date(splits[2], splits[1] - 1, splits[0]);
const days = daysOfTheWeek.map( str => weekdays.indexOf(str));
console.log('fday', fday)
console.log('days', days);
@anvk
anvk / promises_reduce.js
Last active September 8, 2024 15:10
Sequential execution of Promises using reduce()
function asyncFunc(e) {
return new Promise((resolve, reject) => {
setTimeout(() => resolve(e), e * 1000);
});
}
const arr = [1, 2, 3];
let final = [];
function workMyCollection(arr) {
@DrewML
DrewML / Theming-Slack-OSX.md
Last active January 25, 2022 00:53
Theming Slack for OSX

Theming Slack for OSX

So, you love Slack, but you hate applications with large white backgrounds? Why not use Dark Mode!

Unfortunately, Slack does not have a Dark Mode, although it's on their list of possibilities.

But, don't fret - there is a solution! Because the slack native desktop apps are just wrappers around a web app, we can inject our own CSS to customize the application to our liking.

How to (OSX Only)

@shagunsodhani
shagunsodhani / DistBelief.md
Created April 2, 2016 07:10
Notes for "Large Scale Distributed Deep Networks" paper

Large Scale Distributed Deep Networks

Introduction

  • In machine learning, accuracy tends to increase with an increase in the number of training examples and number of model parameters.
  • For large data, training becomes slow on even GPU (due to increase CPU-GPU data transfer).
  • Solution: Distributed training and inference - DistBelief
  • Link to paper

DistBelief

@binaryfun
binaryfun / backup.js
Created March 31, 2016 01:01
Simple node.js file backup script
#!/usr/bin/env node
/* aaron 12/22/2014 backup script
I put this in my ~/bin directory named "bk"
chmod 700 ~/bin/bk
Then, whenever I am going to edit an important file,
I first back it up by running
bk fileName */
//Change this to match your directory
var target_dir = '/home/aaron/backups/files/';
@jianminchen
jianminchen / SherlockAndAnagram12.cs
Created March 27, 2016 21:41
Sherlock and Anagram -
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
class Solution
{
static byte alphabet_count = 26;
static byte a = (byte)'a';
@jianminchen
jianminchen / SherlockAndAnagram11.cs
Created March 27, 2016 21:00
Sherlock And Anagram - C# define a new class with all functions - hashcode
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SherlockAndAnagrams
{
class CharCount
@stefanthoss
stefanthoss / mysql-pandas-import.py
Last active December 26, 2023 19:48
Import data from a MySQL database table into a Pandas DataFrame using the pymysql package.
import pandas as pd
import pymysql
from sqlalchemy import create_engine
engine = create_engine("mysql+pymysql://USER:PASSWORD@HOST:PORT/DBNAME")
df = pd.read_sql_query("SELECT * FROM table", engine)
df.head()