I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!
\
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
# Create display override file to force Mac OS X to use RGB mode for Display | |
# see http://embdev.net/topic/284710 | |
require 'base64' | |
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay` | |
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten | |
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--[[ | |
LuaJIT-cURL | |
Lucien Greathouse | |
LuaJIT FFI cURL binding aimed at cURL version 7.38.0. | |
Copyright (c) 2014 lucien Greathouse | |
This software is provided 'as-is', without any express | |
or implied warranty. In no event will the authors be held | |
liable for any damages arising from the use of this software. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
#include <stdlib.h> | |
#include <gmp.h> | |
char * polynomial="-74101463560860539810482394216134472786413399/404009590666424903383979388988167534591844018460526499864038804741201731572423877094984692537474105135297393596654648304117684895744000000000000000000000*x^99 + 1786563401621773217421750502452955853226339781/1943688752347061390850759947022111850270039951356484879070977067483444756705819339975871373032521468004867185688372878439054154137600000000000000000000*x^98 - 27321291157050372775340569532625689973429185264741/12024094960310264981666053243695462339042976739896622019763059664916718201560234437350734896948634081407660523709959770955883479040000000000000000000000*x^97 + 4936870031754926645682423836151042176171669450909/1336493173680525187613977630110369004256312194947800263402124063124652591386915768177479078216982141485276408003996973457735680000000000000000000000*x^96 - 24473118674386691114350902920738421254018653211816783/55093218603941649400531744530105211175454647 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mod1 = 2147483563 | |
mod2 = 2147483399 | |
mult1 = 40014 | |
mult2 = 40692 | |
seed1 = 12345 | |
seed2 = 67890 | |
def seed(n): | |
global seed1, seed2, mod1, mod2 | |
if n < 0: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# imgur_backup.sh | |
# Backup all Imgur URLs found in a given directory using ripgrep + wget. Searches all text files, binary files, PDFs, database dumps, etc. for any imgur URLs and downloads them into a local directory. | |
# | |
# Note: make sure you apt/brew install ripgrep first, and replace grep with ggrep (brew install grep) on macOS | |
# Usage: | |
# | |
# $ mkdir db_dumps | |
# $ docker-compose exec postgres env PGPASSWORD=somepassword pg_dump -U someuser somedb > ./db_dumps/db_dump.sql | |
# $ bash imgur_backup.sh db_dumps |