Skip to content

Instantly share code, notes, and snippets.

View xSavitar's full-sized avatar
🏠
In the shadows... 🌩

Derick Alangi xSavitar

🏠
In the shadows... 🌩
View GitHub Profile
@xSavitar
xSavitar / floyd_tah.c
Last active June 28, 2021 16:48
Floyd's tortoise and hare algorithm for cycle detection.
// Created by Derick Alangi on 6/28/21.
/* Simple cycle detection algorithm */
#include <stdio.h>
#include <stdlib.h>
typedef struct node {
int data;
struct node* next;
@xSavitar
xSavitar / search-git-history.md
Created January 31, 2019 18:39 — forked from lyoshenka/search-git-history.md
Search Git commit history for a string and see the diffs

Searching Git commit history

This should be one of the core features of Git, but for some reason it's impossible to figure out how to search for a string in your commit history and see the diffs that that string is in. Here's the best I've come up with:

To find which commits and which files a string was added or removed in:

git log -S'search string' --oneline --name-status

To see the diff of that

@xSavitar
xSavitar / labs_schema.sql
Created December 23, 2017 17:14 — forked from mahmoud/labs_schema.sql
labs schema for hashtag caching
CREATE TABLE /*_*/hashtags (
ht_id int NOT NULL PRIMARY KEY AUTO_INCREMENT,
ht_text varbinary(767) NOT NULL default '',
ht_create_timestamp varbinary(14) NOT NULL default '');
CREATE INDEX /*i*/ht_text ON hashtags (ht_text);
CREATE INDEX /*i*/ht_create_timestamp ON hashtags (ht_create_timestamp);
CREATE TABLE /*_*/hashtag_recentchanges (
ht_id int NOT NULL,
@xSavitar
xSavitar / update-script.sh
Last active June 14, 2021 20:50
Recursively update all (with `git pull`) sub-directories (upstreams) in a parent directory (assuming many sub-directories).
#!/bin/bash
for dir in *; do
if [ -d "$dir" ]; then
echo -e "\nUpdating $dir extension, please wait...\n";
(cd "$dir" && git pull origin master)
@xSavitar
xSavitar / csv-to-json.php
Created September 26, 2016 15:15 — forked from robflaherty/csv-to-json.php
Convert CSV to JSON
<?php
/*
* Converts CSV to JSON
* Example uses Google Spreadsheet CSV feed
* csvToArray function I think I found on php.net
*/
header('Content-type: application/json');
// Set your CSV feed