Skip to content

Instantly share code, notes, and snippets.

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

Habibillah Busri habibillah

🏠
Working from home
View GitHub Profile
curl 'https://www.disway.id/comment' -H 'Content-Type: application/x-www-form-urlencoded \
-H 'Accept: application/json' charset=UTF-8' \
--data 'text=mantab+pak+bos&name=You&created_by_current_user=false&username=habibillah&email=habibillah%40yahoo.com&website=&content_id=1589'
{
"page": 1,
"total_pages": 1,
"total_items": "3",
"items": [
{
"id": 1,
"item_id": 4,
"type": "petition",
"detail": {
@habibillah
habibillah / saved-item-response.json
Created July 20, 2016 05:28
saved item response sample
{
"page": 1,
"total_pages": 3,
"total_items": "21",
"items": [
{
"id": 1,
"item_id": 1,
"type": "petition",
"detail": {
@habibillah
habibillah / decrypt.php
Created May 24, 2016 05:58
The stupid way to decript code that defuscate using eval and deflate
<?php
$string = file_get_contents("sample-file.txt");
$found = false;
$n = 0;
do {
$found = (strpos($string, 'eval') !== false);
if ($found) {
private static void SqlDataReaderToCSV(SqlDataReader reader, string path)
{
using (StreamWriter writer = new StreamWriter(path))
{
string[] headers = new string[reader.FieldCount];
for (int i = 0; i < reader.FieldCount; i++)
{
headers[i] = string.format("{0}", reader.GetName(i));
}
writer.WriteLine(string.Join(",", headers));
@habibillah
habibillah / GetStoredProcedureRelatedToTableOrView.sql
Created July 24, 2012 03:21
Get stored procedure related to table or view on MSSQL SERVER
SELECT DISTINCT sysobjects.name, sysobjects.xtype
FROM syscomments
INNER JOIN sysobjects ON syscomments.id=sysobjects.id
WHERE syscomments.TEXT LIKE '%table_name_or_view%'
@habibillah
habibillah / CopyDataToNewDatabase.cs
Created December 14, 2011 06:58
Copy table and data from one database(Oracle) to other database(SQlite) using XPO
protected void CopyDataToNewDatabase()
{
//get all data from current database
//(database connection strored in other place and initialize by _unitOfWork)
XPCollection<Item> items = new XPCollection<Item>(_unitOfWork);
items.Load();
//prepare new connection string to other database
string fileLocation = System.Web.Hosting.HostingEnvironment.MapPath(@"~\App_Data\multi_language.db");
string conn = DevExpress.Xpo.DB.SQLiteConnectionProvider.GetConnectionString(fileLocation);
@habibillah
habibillah / writeDataTofile.php
Created July 13, 2011 14:27
very-very simple way to wite file in PHP
function writeDataTofile($data=null) {
$upload_path = APP . 'tmp' . DS . 'logs' . DS . 'trace.log';
$fp = fopen($upload_path,'w');
if (is_array($data)) {
foreach ($data as $key=>$value) {
fwrite($fp, $key . ": " . $value . "\n\r");
}
} else {
fwrite($fp, $key . ": " . $value . "\n\r");
}
@habibillah
habibillah / Right.cs
Created May 15, 2011 10:09
Substring from right
public class Utils
{
public static string Right(string param, int length)
{
string result = param.Substring((param.Length - length), length);
return result;
}
}