Skip to content

Instantly share code, notes, and snippets.

Avatar
🐞
Catching

Giri Annamalai M giriannamalai

🐞
Catching
View GitHub Profile
@giriannamalai
giriannamalai / fixwrongutf8encoding.php
Created May 20, 2020 — forked from kasperkamperman/fixwrongutf8encoding.php
Function to fix ut8 special characters displayed as 2 characters (utf-8 interpreted as ISO-8859-1 or Windows-1252)
View fixwrongutf8encoding.php
<?php header('Content-Type: text/html; charset=utf-8'); ?>
<html>
<head>
<title>Fix wrong encoded UTF8 characters</title>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
</head>
<body>
<pre>
<?php
/* Problem description:
@giriannamalai
giriannamalai / sed 101
Created Apr 27, 2020 — forked from worker8/sed 101
Useful sed regex collection
View sed 101
http://sed.sourceforge.net/sed1line.txt
-------------------------------------------------------------------------
USEFUL ONE-LINE SCRIPTS FOR SED (Unix stream editor) Dec. 29, 2005
Compiled by Eric Pement - pemente[at]northpark[dot]edu version 5.5
Latest version of this file (in English) is usually at:
http://sed.sourceforge.net/sed1line.txt
http://www.pement.org/sed/sed1line.txt
@giriannamalai
giriannamalai / forticlientsslvpn-expect.sh
Created Apr 4, 2020 — forked from mgeeky/forticlientsslvpn-expect.sh
Simple script intended to automate Fortinet SSL VPN Client connection on Linux using expect scripting.
View forticlientsslvpn-expect.sh
#!/bin/bash
# Forticlient SSL VPN Client launching script utilizing expect.
# --------------------------------------------
# CONFIGURATION
# If empty - script will take some simple logic to locate appropriate binary.
FORTICLIENT_PATH=""
@giriannamalai
giriannamalai / part.md
Created Jun 4, 2019 — forked from oisobstudio/part.md
Django Pagination Server-Side Menggunakan DataTable
View part.md

myapp/views.py

import json

from django.views.generic import View
from django.http import HttpResponse
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.db.models import Q
from django.core.serializers.json import DjangoJSONEncoder
@giriannamalai
giriannamalai / VideoStream.php
Created Jul 25, 2018 — forked from ranacseruet/VideoStream.php
PHP VideoStream class for HTML5 video streaming
View VideoStream.php
<?php
/**
* Description of VideoStream
*
* @author Rana
* @link http://codesamplez.com/programming/php-html5-video-streaming-tutorial
*/
class VideoStream
{
private $path = "";
@giriannamalai
giriannamalai / JavaScript.sublime-build
Created Feb 16, 2018 — forked from corbanb/JavaScript.sublime-build
Sublime Text - Tools > Build System > New Build System
View JavaScript.sublime-build
// Sublime Text - Build System for Javascript
{
"cmd": ["node", "$file"],
"selector": "source.js"
}
@giriannamalai
giriannamalai / fork-example.php
Created Dec 23, 2017 — forked from nicksantamaria/fork-example.php
Example: Parallel processing in PHP using pcntl_fork()
View fork-example.php
<?php
/**
* @file
* Basic demonstration of how to do parallel threads in PHP.
*/
// This array of "tasks" could be anything. For demonstration purposes
// these are just strings, but they could be a callback, class or
// include file (hell, even code-as-a-string to pass to eval()).
@giriannamalai
giriannamalai / eloquent.md
Created Nov 14, 2017 — forked from msurguy/eloquent.md
Laravel 4 Eloquent Cheat Sheet.
View eloquent.md

Conventions:

Defining Eloquent model (will assume that DB table named is set as plural of class name and primary key named "id"):

class Shop extends Eloquent {}

Using custom table name

protected $table = 'my_shops';

@giriannamalai
giriannamalai / Enhance.js
Created Nov 10, 2017 — forked from sebmarkbage/Enhance.js
Higher-order Components
View Enhance.js
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
}
render() {
You can’t perform that action at this time.