Skip to content

Instantly share code, notes, and snippets.

hunj /
Created Apr 29, 2020 — forked from kordless/
Rust Server Deployment for Google Container Engine

Howdy Y'all! I'm @kordless on YouTube and I occasionally play and stream Rust, the game.

This repo is for deploying a Rust Server running on Google Container Engine. Google has a deal going where you can get $300 of free credits for a year on Google Cloud, so it's a good excuse to signup and run your own server. And no, I don't work for Google!

This deployment uses an image built by @dids, which is hosted on Docker Hub:

This deployment method can be used to start a small server to play with friends or practice building things. In a few days, I'll update the scripts to include a way to save the content you've created, in-game, with others who can then run their own servers and load your content in to explore it for themselves.

For now, start by navigating to Google Cloud and signup for an account. You'll need to enter some credit card details to get this going, but Google is giving you $300 in credits for the next year. Should be e

hunj /
Created Jul 11, 2018
[Python] Inspect params inside a function
import inspect
frame = inspect.currentframe()
args, _, _, values = inspect.getargvalues(frame)
print('function name "%s"' % inspect.getframeinfo(frame)[2])
for i in args:
print(" %s = %s" % (i, values[i]))
hunj / gist:8549840acc266c1e19761959bd028300
Created Dec 1, 2016
result of running `python 1`
View gist:8549840acc266c1e19761959bd028300
Calculated pi: 3.1411426428303537942242780347543442930366295786973371671458932366545818227278409801225153144143017877234654331791473934241780222527815976997124640580072509063632954119264908113514189273659207400925115639454931866483310413801725215651956494561820227528441055131891486435804475559444930616327040880110013751718964870608826103262907863482935366920865108138517314664333041630203775471933991748968621077634704338042255281910238779847480935116889611201400175021877734716839604950618827353419177397174646830853856732091511438929866233279159894986873359169896237029628703587948493561695211901487685960745093136642080260032504063007875984498062257782222777847230903862982872859107388423552944118014751843980497562195274409301162645330666333291661457682210276284535566945868233529191148893611701462682835354419302412801600200025003125390673834229278659832479059882485310663832979122390298787348418552319039879984998124765595699462432804100512564070508813601700212526565820727590948868608576072009001125140642580322540
hunj /
Created Nov 8, 2016
Compute π using Nilakantha's series
from decimal import *
def compute_pi():
pi = Decimal(3.0)
curr_multiplier = Decimal(2)
iteration = Decimal(0)
load = Decimal(1)
getcontext().prec = 6
while 1:
hunj / euler_003.rb
Last active Jun 15, 2016
Project Euler #003 solution, comparing with square root
View euler_003.rb
require 'benchmark'
the_number = 600_851_475_143
# monkeypatching
class Fixnum
def prime? # O(n)
(2..(self - 1)).each do |divisor|
return false if self % divisor == 0
hunj / gen.rb
Created Mar 6, 2016
Generate random numbers
View gen.rb
require 'csv'
# Data generation
@data = {}
(0..100).each do |i|
@data[i] = {
:age => Random.rand(18...80),
:gender => Random.rand(0..1),
:prescription_history => []
View perfect_number.rb
def perfect_number? number
return number == divisors_of(number)
def divisors_of number
arr = []
(1..number).each do |iter|
if number % iter == 0
arr << iter
hunj / dummy_generate.rb
Created Sep 24, 2015
Generates a dummy file full of 0's and 1's up to desired size
View dummy_generate.rb
DESIRED_SIZE = 1073741824 # 1gb
FILE_NAME = "dummy" # name of the dummy file
dummy_file =, "w")
while dummy_file.size < DESIRED_SIZE
hunj / The Technical Interview Cheat
Last active Aug 29, 2015 — forked from TSiege/The Technical Interview Cheat
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.
View The Technical Interview Cheat

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
hunj / path_strip.rb
Created Jul 7, 2015
Strip path from domain
View path_strip.rb
# path_strip(input_file, domain, output_file)
# imports an xml file containing paths of the website's pages,
# strips all unnecessary strings except for the path of the pages.
## Parameters:
# +input_file+ name of the input xml file
# +domain+ the domain of the URL to exclude in the result
# +output_file+ name of the output file, ending in .csv (preferred)
def path_strip(input_file, domain, output_file)
raise "domain must be string form" unless domain.is_a? String
raise "invalid input file name" unless input_file.is_a? String