Skip to content

Instantly share code, notes, and snippets.

View danielnegri's full-sized avatar
Coffee first.

Daniel Negri danielnegri

Coffee first.
View GitHub Profile
@devisnotnull
devisnotnull / installing_kubernetes_on_proxox.md
Last active January 1, 2024 12:33
Installing Kubernetes on Proxox, Herzner

Installing Kubernetes on Proxox

For this example i shall be using a dedicated server from Hertzner.https://www.hetzner.de/en/. A shout out to hetzner if your looking for cheap and beefy dedicated hosting then these guys are your best bet.

Setting up the Hertzer server

This guide assumes your server has Debian 8 (Jessie installed)

Config when tested

#!/bin/bash
IPADDR=""
if [ -f /usr/bin/ec2metadata ]
then
IPADDR=`timeout 1 ec2metadata --public-hostname`
fi
if [ "$IPADDR" = "" ]
then
@danielnegri
danielnegri / FB-PE-InterviewTips.md
Created July 1, 2020 00:32 — forked from ameenkhan07/FB-PE-InterviewTips.md
Facebook Production Engineering Interview

What to Expect and Tips

• 45-minute systems interview, focus on responding to real world problems with an unhealthy service, such as a web server or database. The interview will start off at a high level troubleshooting a likely scenario, dig deeper to find the cause and some possible solutions for it. The goal is to probe your knowledge of systems at scale and under load, so keep in mind the challenges of the Facebook environment.
• Focus on things such as tooling, memory management and unix process lifecycle.

Systems

More specifically, linux troubleshooting and debugging. Understanding things like memory, io, cpu, shell, memory etc. would be pretty helpful. Knowing how to actually write a unix shell would also be a good idea. What tools might you use to debug something? On another note, this interview will likely push your boundaries of what you know (and how to implement it).

Design/Architecture 

Interview is all about taking an ambiguous question of how you might build a system and letting

@anupamshakya7
anupamshakya7 / Transformation_From_XSLT
Created April 25, 2014 11:11
How to transform an XML file using XSLT in Python
from lxml import etree
data = open('D:\Conversion\MACSXML_Parts.xslt')
xslt_content = data.read()
xslt_root = etree.XML(xslt_content)
dom = etree.parse('D:\Conversion\Cat2015UF.xml')
transform = etree.XSLT(xslt_root)
result = transform(dom)
f = open('D:\Conversion\MACSXML_Parts.csv', 'w')
f.write(str(result1))
# as we’re going to use Unicorn as the application server
# we’re not going to use common sockets
# but Unix sockets for faster communication
upstream shop {
# fail_timeout=0 means we always retry an upstream even if it failed
# to return a good HTTP response (in case the Unicorn master nukes a
# single worker for timing out).
# for UNIX domain socket setups:
server unix:/tmp/shop.socket fail_timeout=0;
@sander
sander / Dockerfile
Created January 9, 2015 21:55
WordPress image with imagick, ssmtp, gd, freetype
FROM wordpress
RUN apt-get update && apt-get install -y libmagickwand-6.q16-dev --no-install-recommends \
&& ln -s /usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16/MagickWand-config /usr/bin \
&& pecl install imagick \
&& echo "extension=imagick.so" > /usr/local/etc/php/conf.d/ext-imagick.ini
RUN apt-get update && apt-get install -y ssmtp --no-install-recommends \
&& echo 'sendmail_path=/usr/sbin/sendmail -t -i\nsendmail_from=FROM_MAIL_ADDRESS' > /usr/local/etc/php/conf.d/set-sendmail.ini
@Irio
Irio / 2017-09-28-cities.csv
Created October 8, 2017 03:22
[Serenata] 2017-10-07-irio-destino-das-emendas
id city state_id state_name state
1100015 Alta Floresta D'Oeste 11 Rondônia RO
1100023 Ariquemes 11 Rondônia RO
1100031 Cabixi 11 Rondônia RO
1100049 Cacoal 11 Rondônia RO
1100056 Cerejeiras 11 Rondônia RO
1100064 Colorado do Oeste 11 Rondônia RO
1100072 Corumbiara 11 Rondônia RO
1100080 Costa Marques 11 Rondônia RO
1100098 Espigão D'Oeste 11 Rondônia RO
@aereal
aereal / gist:2802359
Created May 27, 2012 06:03
Guardfile for Rails with Factory Girl
guard 'rspec', version: 2, cli: File.read('.rspec').each_line.map(&:strip).join(' '), all_after_pass: false, all_on_start: false do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { "spec" }
# Rails example
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch(%r{^app/(.*)(\.erb|\.haml|\.slim)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
@dcsobral
dcsobral / modifyZIP.scala
Created September 28, 2012 16:24
Adds a fake header to ZIP files to produce valid ZIP files that ZipInputStream cannot decode
#!/bin/sh
exec scala "$0" "$@"
!#
import java.io._
if (args.length != 2)
sys.error("Please pass input and output files as parameters")
val inputFile = new File(args(0))
val outputFile = new File(args(1))
@thor27
thor27 / hanoi.py
Last active August 29, 2015 13:56
Hanoi Tower
import os
class Game(dict):
def __init__(self, number_of_piecies, frontend=lambda x:None, start_column=0b001, end_column=0b100):
super(Game, self).__init__()
for column in [0b001, 0b010, 0b100]:
self[column] = Column(self)
self.frontend = frontend(self)
for num in range(number_of_piecies,0,-1):
Piece(num,self,0b001)