Skip to content

Instantly share code, notes, and snippets.

View KennethanCeyer's full-sized avatar
🤣
Making freaking awesome stuff

Sungmin Han KennethanCeyer

🤣
Making freaking awesome stuff
View GitHub Profile
@KennethanCeyer
KennethanCeyer / index.js
Last active January 21, 2016 16:46
AWS Lambda isn't supporting "yum install command".
var fs = require('fs');
var url = require('url');
var https = require('https');
var exec = require('child_process').exec;
var simpleGit = require('simple-git')();
var archiver = require('archiver');
var token = '[Your GitHub OAuth Token]';
var file_name = './deploy';
var version = '122632';
@KennethanCeyer
KennethanCeyer / gist:687b9aedc7cd95927efc
Created October 28, 2015 22:43
Implements of BaseAdapter model
public class CheckBoxAdapter extends BaseAdapter {
@Override
public int getCount() {
return 0;
}
@Override
public Object getItem(int position) {
return null;
}
@KennethanCeyer
KennethanCeyer / .bash_profile
Last active July 15, 2024 03:43
bash_profile for MAC users
#.bash_profile
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
#============================================================
#
# ALIASES AND FUNCTIONS
# Arguably, some functions defined here are quite big.
# If you want to make this file smaller, these functions can
@KennethanCeyer
KennethanCeyer / wpf_tabcontrol_selection_changed_problem.cs
Created October 6, 2015 18:05
WPF TabControl Selection Changed : The solution that problem calling those event infinitely.
private void MainTabChanged(object sender, SelectionChangedEventArgs e)
{
int tabItem = ((sender as TabControl)).SelectedIndex;
if (e.Source is TabControl) // This is a soultion of those problem.
{
switch (tabItem)
{
case 0: // Chatting
Debug.WriteLine("Tab: Chatting");
if (MainChatList.Items.Count > 0)
@KennethanCeyer
KennethanCeyer / android_listview_additem.java
Created October 4, 2015 06:48
Android ListView Add Item From Array
ListView mList = (ListView) findViewById(R.id.mainList);
String[] items = new String[] {
"Hello World!",
"Foo Bar",
"404 Not Found",
"Dev Students"
};
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_expandable_list_item_1, items);
mList.setAdapter(adapter);
@KennethanCeyer
KennethanCeyer / ListBox_Add_Two_Textblock.cs
Created October 4, 2015 06:33
How to Add more than two TextBlock object in ListBoxItem
ListBoxItem lb = new ListBoxItem();
DockPanel dp = new DockPanel();
TextBlock user = new TextBlock();
user.Text = data.name;
if(data.color != null)
{
user.Foreground = (SolidColorBrush)(new BrushConverter().ConvertFrom("#" + data.color));
}
TextBlock tb = new TextBlock();
tb.TextWrapping = TextWrapping.Wrap;
@KennethanCeyer
KennethanCeyer / list_view_textwrapping.cs
Created October 3, 2015 11:09
ListView TextWrapping using TextBlock
ListBoxItem lb = new ListBoxItem();
TextBlock tb = new TextBlock();
/* ListView TextWrapping using TextBlock. */
tb.TextWrapping = TextWrapping.Wrap;
tb.Text = data;
lb.Content = tb;
MainChatList.Items.Add(lb);
MainChatList.SelectedIndex = MainChatList.Items.Count - 1;
MainChatList.ScrollIntoView(MainChatList.Items[MainChatList.Items.Count - 1]);
@KennethanCeyer
KennethanCeyer / Socket-packet-little-endian-and-big-endian.cs
Created October 1, 2015 01:27
About little endian and big endian when socket programing
private List<byte> bnetData = new List<byte>();
private BnetHelper bnetHelper = BnetHelper.getInstance();
public byte bnetCommand;
public int serverToken = 0;
public int clientToken = 0;
public BnetProtocol()
{
}
@KennethanCeyer
KennethanCeyer / C-Sharp-Socket-IPAdress-From-DNS.cs
Created October 1, 2015 01:24
C# Socket bind ip from the dns domain name.
IPAddress bnetServerIP = Dns.GetHostAddresses(bnetConInfo["ip"])[0];
IPEndPoint bnetServerEP = new IPEndPoint(bnetServerIP, Int32.Parse(bnetConInfo["port"]));
this.bnetSock = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
byte[] receiveBuffer = new byte[255];
try
{
this.bnetSock.ReceiveBufferSize = Int32.MaxValue;
this.bnetSock.ReceiveTimeout = 3000;
this.getHandleMsg(BnetCode.ConnectionWithServer);
@KennethanCeyer
KennethanCeyer / hex_to_byte_dword_or_not.cs
Created October 1, 2015 01:11
It uses for the game client packet. If you treat the variable to DWORD or not, it makes you wish.
public void setBnetByte(String strData, bool isVariable = false)
{
String hexData = bnetHelper.Acsii2Hex(strData);
if (isVariable)
{
byte[] bData = bnetHelper.Hex2Byte(hexData);
this.setBnetByte(bData);
}
else {
UInt32 intData = UInt32.Parse(hexData, System.Globalization.NumberStyles.AllowHexSpecifier);