Skip to content

Instantly share code, notes, and snippets.

View Tetz's full-sized avatar
😈
Emacs with Evil

Tetsuro Takemoto Tetz

😈
Emacs with Evil
  • Ineeza
  • Amsterdam, Netherlands
View GitHub Profile
@Tetz
Tetz / HttpTest.cpp
Last active March 24, 2017 08:47
HTTP Client for Cocos2dx
// As a onClick event
void HelloWorld::onClick()
{
// Setting HTTP Request Header
std::vector<std::string> headers;
headers.push_back("Content-Type: application/json; charset=utf-8");
// Creating a URL
cocos2d::extension::CCHttpRequest * request = new cocos2d::extension::CCHttpRequest();
request->setUrl("http://example.com");
@Tetz
Tetz / .bashrc
Created July 13, 2015 03:25
Linux Prompt Color
PS1='\[\e[1;32m\][\u@ServerName \W]\$\[\e[0m\] '
@Tetz
Tetz / UUIDGenerator.scala
Created December 21, 2015 12:31
modern-web/app/services/UUIDGenerator.scala
package services
import javax.inject.Singleton
import java.util.UUID
/**
* A type declaring the interface that will be injectable.
*/
abstract class UUIDGenerator() {
def generate: UUID
@Tetz
Tetz / sass-structure.md
Last active July 26, 2016 09:58
Architecture for a Sass Project
sass/ 
| 
|– base/ 
|   |– _reset.scss       # Reset/normalize 
|   |– _typography.scss  # Typography rules 
|   ...                  # Etc… 
| 
|– components/ 
|   |– _buttons.scss     # Buttons 
@Tetz
Tetz / bash_prompt.sh
Last active March 11, 2017 09:25
Add this to your .bashrc
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# get current status of git repo
function parse_git_branch {
status=`git status 2>&1 | tee`
# Remove current php & apache
sudo service httpd stop
sudo yum remove httpd* php*
# Remove any third party repos that aren't relevant
sudo yum repolist
sudo yum remove remi-safe
# Install Standard Apache for Amazon AMI
sudo yum install httpd #specify http22 if you get a different version
@Tetz
Tetz / play_server_setup.md
Last active December 7, 2016 02:19
scala, play framework, sbt, java8

Install Utils

sudo yum install git
sudo yum isntall tree

Remove JDK7 and Install JDK8 on Amazon Linux

sudo yum remove java-1.7.0-openjdk
sudo yum install java-1.8.0-openjdk
@Tetz
Tetz / display_network_packets.sh
Created March 9, 2017 11:35
use in api server
sudo ngrep -q -d eth0 -W byline port 80
@Tetz
Tetz / resizeImage.swift
Created May 28, 2018 07:56
Retina compatible
func resizeImage(image: UIImage, newWidth: CGFloat) -> UIImage {
let scale = newWidth / image.size.width
let newHeight = image.size.height * scale
UIGraphicsBeginImageContextWithOptions(CGSize(width: newWidth, height: newHeight), false, 0.0)
image.draw(in: CGRect(x: 0, y: 0,width: newWidth, height: newHeight))
let newImage = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
@Tetz
Tetz / tweetbot.py
Created June 6, 2018 06:24
Symphony Tweet Bot
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
import symphony
import tweepy as tp
import json
import operator
import time