Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View Reve's full-sized avatar

Alexandru Gheorghita Reve

  • Bucharest, Romania
View GitHub Profile
@nathandem
nathandem / pdf.py
Last active February 7, 2022 08:23
Arbitrary header/footer integration in Weasyprint PDF pages
from weasyprint import HTML, CSS
class PdfGenerator:
"""
Generate a PDF out of a rendered template, with the possibility to integrate nicely
a header and a footer if provided.
Notes:
------
@Cosmo
Cosmo / m3u.swift
Last active August 21, 2023 09:59
Swift M3U Parser
struct MediaItem {
var duration: Int?
var title: String?
var urlString: String?
static func parseM3U(contentsOfFile: String) -> [MediaItem]? {
var mediaItems = [MediaItem]()
contentsOfFile.enumerateLines({ line, stop in
if line.hasPrefix("#EXTINF:") {
let infoLine = line.stringByReplacingOccurrencesOfString("#EXTINF:", withString: "")
@dgershman
dgershman / patch_vpn.sh
Created July 25, 2014 15:18
This fix patches up a Cisco VPN connection on OSX to not disconnect after 1 hour and instead 1 day.
sudo mkdir /etc/racoon/remote
sudo mv /var/run/racoon/*.conf /etc/racoon/remote
sudo sed -i.bak 's/lifetime time 3600 sec/lifetime time 168 hours/' /etc/racoon/remote/*.conf
sudo patch /etc/racoon/racoon.conf <<EOF
--- /etc/racoon.orig/racoon.conf 2009-06-23 09:09:08.000000000 +0200
+++ /etc/racoon/racoon.conf 2009-12-11 13:52:11.000000000 +0100
@@ -135,4 +135,5 @@
# by including all files matching /var/run/racoon/*.conf
# This line should be added at the end of the racoon.conf file
# so that settings such as timer values will be appropriately applied.
@m1entus
m1entus / build-ffmpeg.sh
Last active June 11, 2023 06:42
Installing ffmpeg ios libraries armv7, armv7s, i386
#!/bin/bash
###########################################################################
# Choose your ffmpeg version and your currently-installed iOS SDK version:
#
VERSION="2.0.2"
SDKVERSION="7.0"
ARCHS="armv7 armv7s i386"
#
#
@geoffb
geoffb / simple_websocket_client.html
Created October 7, 2010 23:37
Super simple websockets client/server using Python. Compatible with the draft 76 challenge/response.
<!DOCTYPE html>
<html lang="en">
<head>
<title>WebSocket Client</title>
<style>
#output {
border: solid 1px #000;
}
</style>
</head>