Skip to content

Instantly share code, notes, and snippets.

View menangen's full-sized avatar
🏠
Working from home

Andru Menangen menangen

🏠
Working from home
View GitHub Profile
@menangen
menangen / pow.int.c
Created March 14, 2018 22:39
Exponentiation by squaring
int ipow(int base, int exp)
{
int result = 1;
while (exp)
{
if (exp & 1)
result *= base;
exp >>= 1;
base *= base;
}
@menangen
menangen / project.pbxproj
Created March 16, 2018 18:27
OSX Command Line Tool with Swift Cocoa Library
LD_RUNPATH_SEARCH_PATHS = (
"$(TOOLCHAIN_DIR)/usr/lib/swift/macosx",
"@executable_path",
);
SWIFT_FORCE_DYNAMIC_LINK_STDLIB = YES;
SWIFT_FORCE_STATIC_LINK_STDLIB = NO;
ffmpeg -y -i src/IMG.MOV -x265-params level=5.1:vbv-maxrate=4000:vbv-bufsize=7000:qcomp=0.5:vbv-init=0.5:crf=23:crf-min=17 -vf scale=1280:720 -sws_flags spline -map_metadata:g 0:g -f mp4 -c:v libx265 -preset medium -tag:v hvc1 -copyts -vsync 0 -time_base 1/60 -video_track_timescale 600 -c:a copy -threads 8 out/[h265-720p]IMG.mp4
@menangen
menangen / caddy.service
Created May 24, 2018 19:50
Systemd init scripts
[Unit]
Description=Caddy HTTP/2 web server
Documentation=https://caddyserver.com/docs
After=network-online.target
Wants=network-online.target systemd-networkd-wait-online.service
[Service]
Restart=on-abnormal
; User and group the process will run as.
@menangen
menangen / make.sh
Created June 17, 2018 14:38
Tor compiling from sources (Mac OS)
# Build libevent:
./configure --prefix=/Volumes/RAMDisk/opt/libevent --disable-shared --enable-static --with-pic
make -j4
make install
# Build tor:
./configure --enable-static-libevent --with-libevent-dir=/Volumes/RAMDisk/opt/libevent/
make -j4
@menangen
menangen / thread_test.c
Created July 11, 2018 05:40
POSIX threads
//
// thread_test.c
// testingSwift & C with SPM
//
// Created by menangen on 11.07.18.
// Copyright (c) 2018 menangen. All rights reserved.
//
#import <stdio.h>
#import <stdlib.h>
#import <pthread.h>
@menangen
menangen / UDPClient.swift
Last active September 6, 2018 14:18
Apple Network Framework. Swift UDP hello world
//
// UDPClient.swift
// NetworkUDP
//
// Created by menangen on 31.08.2018.
//
//
import Foundation
import Network
@menangen
menangen / main.c
Last active September 17, 2018 20:03
newDES C implementation
//
// main.c
// newDES
//
// Created by menangen on 12.09.2018.
// Copyright © 2018 menangen. All rights reserved.
//
#include <stdio.h>
#import "newDES.h"
@menangen
menangen / main.xml
Created November 2, 2018 16:05
Flex 3.6 app
<?xml version="1.0"?>
<!-- Simple example to demonstrate the Accordion layout container. -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Panel title="Accordion Container Example" height="90%" width="90%"
paddingTop="10" paddingLeft="10" paddingRight="10" paddingBottom="10">
<mx:Label width="100%" color="blue"
text="Select an Accordion navigator button to change the panel."/>
import Cocoa
import MetalKit
// Our macOS specific view controller
class GameViewController: NSViewController {
var renderer: Renderer!
var mtkView: MTKView!
override func viewDidLoad() {